{%- macro editVal(name, value ,id) -%}
    <input
            id="val_{{ name }}_{{ id }}"
            type="text" value="{{ value }}"
            class="layui-input edit_val"
            data-id="{{ id }}"
            data-name="{{ name }}"
            data-selector='#val_{{ name }}_{{ id }}'
            {#onblur="__doPostBack('setAttr','id={{ id }}&{{ name }}='+ $('#val_{{ name }}_{{ id }}').val())"#}
    >
{%- endmacro -%}

{%- macro manage(name,value,id) -%}
    <div class="layui-btn-group">
        <a href="{{ path(name ~ "PreAdd") }}?parent={{ id }}" class="layui-btn layui-btn-normal layui-btn-sm"><span class="fa fa-plus c13"></span></a>
        <a href="{{ path(name ~ "PreEdit",{'id':id}) }}" class="layui-btn layui-btn-normal layui-btn-sm"><span class="fa fa-edit c13"></span></a>
    </div>
{%- endmacro -%}

{%- macro add(name,value,id) -%}
    <div class="layui-btn-group">
        <a href="{{ path(name ~ "PreAdd") }}?parent={{ id }}" class="layui-btn layui-btn-normal layui-btn-sm"><span class="fa fa-plus c13"></span></a>
    </div>
{%- endmacro -%}

{%- macro edit(name,value,id) -%}
    <div class="layui-btn-group">
        <a href="{{ path(name ~ "PreEdit",{'id':id}) }}" class="layui-btn layui-btn-normal layui-btn-sm"><span class="fa fa-edit c13"></span></a>
    </div>
{%- endmacro -%}

{%- macro copy(name,value,id) -%}
    <div class="layui-btn-group">
        <a href="{{ path(name ~ "DoCopy",{'id':id}) }}" class="layui-btn layui-btn-normal layui-btn-sm"><span class="fa fa-copy c13"></span></a>
    </div>
{%- endmacro -%}

{%- macro switch(name,value,id) -%}

    {% if value == 1 %}
        <a href="javascript:__doPostBack('setAttr','id={{ id }}&{{ name }}=0');">
            <input type="checkbox" lay-skin="switch" checked />
        </a>
    {% else %}
        <a href="javascript:__doPostBack('setAttr','id={{ id }}&{{ name }}=1');">
            <input type="checkbox" lay-skin="switch"  />
        </a>
    {% endif %}
{%- endmacro -%}

{%- macro text(name,value,id) -%}
        {{ value }}
{%- endmacro -%}


{%- macro day(name,value,id) -%}
    {#{{ dump(value) }}#}
    {% if value  %}
        {{ value | date("Y-m-d H:i:s") }}
    {% else  %}
        -
    {% endif %}
{%- endmacro -%}


{%- macro pic(name,value,id) -%}
    <img src="{{ value }}"  alt="" onclick="showPicInList('{{ value }}')" style="max-height: 200px;mx-width: 300px!important;">
    {#{{ value }}#}
{%- endmacro -%}

{%- macro pics(name,pics,id) -%}
    {% for item in pics %}<img src="{{ item }}"  alt="" onclick="showPicInList('{{ item }}')" style="max-height: 200px;mx-width: 300px!important;">{% endfor %}
{%- endmacro -%}

{%- macro file(name,file,id) -%}
    {#{% for item in files %}#}
        <p><a href="{{file.file }}">{{ file.name }}</a></p>
    {#{% endfor %}#}
{%- endmacro -%}
{%- macro files(name,files,id) -%}
    {% for item in files %}
        <p><a href="{{item.file }}">{{ item.name }}</a></p>
    {% endfor %}
{%- endmacro -%}

{%- macro article(name,value,id) -%}
    <p>{{ value|striptags|slice(0,100) }}</p>
{%- endmacro -%}


{%- macro tab(level) -%}
    {% if level > 0 %}
        {% for i in 0..level %}&nbsp;&nbsp;&nbsp;&nbsp;{% endfor %}
        ├{% for i in 0..level %}─{% endfor %}
    {% endif %}
{%- endmacro -%}



{%- macro date(time) -%}
    {% if time %}
        {{ time | date("Y-m-d H:i:s") }}
        {% else %}
        0000-00-00 00:00:00
    {% endif %}
{%- endmacro -%}





    {#<div class="layui-btn-group">#}
        {#{% if value == 1 %}#}

            {#<input type="checkbox" value="1" lay-skin="switch" onchange="__doPostBack('setAttr','id={{ id }}&{{ name }}=0')">#}
            {#<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-sm">是</a>#}
            {#<a href="javascript:__doPostBack('setAttr','id={{ id }}&{{ name }}=0');" class="layui-btn layui-btn-primary layui-btn-sm">否</a>#}
            {#<a href="javascript:__doPostBack('setAttr','id={{ Entity.SAMPLE_id }}&isHot=0');" style="color: red;">是</a>#}
        {#{% else %}#}
            {#<input type="checkbox" value="0" lay-skin="switch" onchange="__doPostBack('setAttr','id={{ id }}&{{ name }}=1')">#}
            {#<a href="javascript:__doPostBack('setAttr','id={{ id }}&{{ name }}=1');" class="layui-btn layui-btn-primary layui-btn-sm">是</a>#}
            {#<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-sm">否</a>#}
            {#<a href="javascript:__doPostBack('setAttr','id={{ Entity.SAMPLE_id }}&isHot=1');" style="color: green;">设置热门</a>#}
        {#{% endif %}#}
    {#</div>#}